#pragma once

#include <list>
#include <algorithm>
#include <BWAPI.h>

typedef BWAPI::Position Point;
class TerrainManager;

class Region
{
public:
	Region(BWAPI::Color color);
	~Region(void);

	void insertPoint(Point point);
	void removePoint(Point point);

	bool isInside(Point P);
	bool isNeighbor(Point P);
	Point getNearestPoint(Point P);

	void draw();

private:
	std::list<Point> mVertices;
	BWAPI::Color mColor;

	std::list<Point> calculateConvexHull(std::list<Point> points);

	static double square2(int value) {return 1.4142*value; }
};
